package org.example.Manager.Impl;

import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import lombok.extern.slf4j.Slf4j;
import org.example.Manager.ProductManager;
import org.example.mapper.ProductMapper;
import org.example.model.ProductDO;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;
import java.util.List;

/**
 * @description:
 * @author: 谢超
 * @date: 2024/3/21 17:31
 */
@Component
@Slf4j
public class ProductManagerImpl implements ProductManager {

    @Resource
    private ProductMapper productMapper;

    @Override
    public List<ProductDO> getList() {
        return productMapper.selectList(null);
    }

    @Override
    public ProductDO getDetail(long productId) {
        return productMapper.selectOne(Wrappers.lambdaQuery(ProductDO.class).eq(ProductDO::getId, productId));
    }
}
